package com.syn.syn1;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @Auther: zch
 * @Date: 2019/1/8 08:56
 * @Description:
 */
public class ScheduledExecutorServiceDemo {
      public static void main(String[] args) throws InterruptedException
          {

              ScheduledExecutorService ses = Executors.newScheduledThreadPool(10);
              ses.scheduleAtFixedRate(new Runnable() {
                  @Override
                  public void run() {
                      try {

                          Thread.sleep(1000);
                          System.out.println(System.currentTimeMillis() / 1000);
                      } catch (InterruptedException e) {
                          e.printStackTrace();
                      }
                  }
              },0,2, TimeUnit.SECONDS);
          }

}
